package com.yuanfeng.business.service.impl;

import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.yuanfeng.business.dto.ComplaintInformationDTO;
import com.yuanfeng.business.entity.ShopComplainBaseEntity;
import com.yuanfeng.business.mapper.ShopComplainBaseMapper;
import com.yuanfeng.business.service.ShopComplainBaseService;
import com.yuanfeng.commoms.exception.BizCodeEnume;
import com.yuanfeng.commoms.util.ParseTokenUtils;
import com.yuanfeng.commoms.util.ResponseResult;
import com.yuanfeng.commoms.util.querypage.PageUtils;
import com.yuanfeng.commoms.vo.user.UserInfoVO;
import org.springframework.stereotype.Service;

/**
 *
 */
@Service
public class ShopComplainBaseServiceImpl extends ServiceImpl<ShopComplainBaseMapper, ShopComplainBaseEntity>
    implements ShopComplainBaseService{


    @Override
    public ResponseResult getFineList(ComplaintInformationDTO param) {
        UserInfoVO ui = ParseTokenUtils.getUserInfoByToken(param.getToken());
        if (ui == null) {
            return ResponseResult.fail(BizCodeEnume.TOKEN_IS_ILLEGAL);
        }
        Page<ShopComplainBaseEntity> page = new Page<>(param.getPage(), param.getLimit());
        IPage<ShopComplainBaseEntity> complainBaseEntityIPage = this.baseMapper.selectPage(page,
                new LambdaQueryWrapper<ShopComplainBaseEntity>()
                        .eq(ShopComplainBaseEntity::getComplainId, param.getComplainId()));
        return ResponseResult.success(PageUtils.getPage(complainBaseEntityIPage));
    }
}




